﻿using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using Orchard.Mvc.Routes;
using System.Web;

namespace Rework.CommerceHistory {
    public class Routes : IRouteProvider {
        public void GetRoutes(ICollection<RouteDescriptor> routes) {
            foreach (var descriptor in GetRoutes()) {
                routes.Add(descriptor);
            }
        }
        
        public IEnumerable<RouteDescriptor> GetRoutes() {
            return new[] {

                #region groups Front Side Routes
                new RouteDescriptor {
                    Priority = 5,
                    Route = new Route(
                        // URL - url pattern for the route (e.g. /groups
                        "PayPal/{action}",
                        new RouteValueDictionary{
                            {"area", "Rework.CommerceHistory"},
                            {"controller","CommercePayPal"},
                        },
                        // Constraints - a regular expression that specifies valid values for a URL paramater
                        new RouteValueDictionary{
                            //{"controller", @"!(Admin)" }, // forces it to NOT contain Admin
                        },
                        // Data Tokens - custom values that are passed to the route handler, 
                        //  but which are not used to determine whether the route matches a specific URL pattern.
                        //  These values are passed to the route handler where they can be used for processing the request
                        new RouteValueDictionary{
                            {"area", "Rework.CommerceHistory"},
                        },
                        // Route Handler - the object that processes the request for the route
                        new MvcRouteHandler())
                },
                #endregion

            };
        }
    }
}